//
//  MZY_ForemanCell.m
//  FullHouse
//
//  Created by dllo on 16/1/21.
//  Copyright © 2016年 yy. All rights reserved.
//

#import "MZY_ForemanCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
#define HORIZONTAL [UIScreen mainScreen].bounds.size.width / 414
#define VERTICAL [UIScreen mainScreen].bounds.size.height / 736

@implementation MZY_ForemanCell

- (void)dealloc
{
    [self.backView release];
    [self.authorImageView release];
    [self.titleLabel release];
    [self.locationLabel release];
    [self.starMarkView release];
    [self.markLabel release];
    [self.commentLabel release];
    [self.oneStarImageView release];
    [self.twoStarImageView release];
    [self.threeStarImageView release];
    [self.fourStarImageView release];
    [self.fiveStarImageView release];
    [self.leftImageView release];
    [self.midLeftImageView release];
    [self.midRightImageView release];
    [self.rightImageView release];
    [self.worksLabel release];
    [self.appointmentLabel release];
    [super dealloc];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    
    self.contentView.backgroundColor = [UIColor cyanColor];
    
    self.backView = [[UIView alloc]init];
    self.backView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.backView];
    [self.backView release];
    
    self.authorImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.authorImageView];
    [self.authorImageView release];
    
    self.titleLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel release];
    
    self.locationLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.locationLabel];
    [self.locationLabel release];
    
    self.starMarkView = [[UIView alloc]init];
//    self.starMarkView.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.starMarkView];
    [self.starMarkView release];
    
    self.markLabel = [[UILabel alloc]init];
//    self.markLabel.backgroundColor = [UIColor lightGrayColor];
    [self.starMarkView addSubview:self.markLabel];
    [self.markLabel release];
    
    self.oneStarImageView = [[UIImageView alloc]init];
//    self.oneStarImageView.backgroundColor = [UIColor yellowColor];
    [self.starMarkView addSubview:self.oneStarImageView];
    [self.oneStarImageView release];
    
    self.twoStarImageView = [[UIImageView alloc]init];
//    self.twoStarImageView.backgroundColor = [UIColor greenColor];
    [self.starMarkView addSubview:self.twoStarImageView];
    [self.twoStarImageView release];
    
    self.threeStarImageView = [[UIImageView alloc]init];
//    self.threeStarImageView.backgroundColor = [UIColor redColor];
    [self.starMarkView addSubview:self.threeStarImageView];
    [self.threeStarImageView release];
    
    self.fourStarImageView = [[UIImageView alloc]init];
//    self.fourStarImageView.backgroundColor = [UIColor purpleColor];
    [self.starMarkView addSubview:self.fourStarImageView];
    [self.fourStarImageView release];
    
    self.fiveStarImageView = [[UIImageView alloc]init];
//    self.fiveStarImageView.backgroundColor = [UIColor brownColor];
    [self.starMarkView addSubview:self.fiveStarImageView];
    [self.fiveStarImageView release];
    
    self.commentLabel = [[UILabel alloc]init];
//    self.commentLabel.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.commentLabel];
    [self.commentLabel release];
    
    self.leftImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.leftImageView];
    [self.leftImageView release];
    
    self.midLeftImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.midLeftImageView];
    [self.midLeftImageView release];
    
    self.midRightImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.midRightImageView];
    [self.midRightImageView release];
    
    self.rightImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.rightImageView];
    [self.rightImageView release];
    
    self.worksLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.worksLabel];
    [self.worksLabel release];
    
    self.textField = [[UITextField alloc]init];
    self.textField.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.textField];
    [self.textField release];
    
    self.appointmentLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.appointmentLabel];
    [self.appointmentLabel release];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.backView.frame = CGRectMake(0, 0, WIDTH, HEIGHT - 10);
    self.authorImageView.frame = CGRectMake(10 * HORIZONTAL, 10 * VERTICAL, 50 * HORIZONTAL, 50 * HORIZONTAL);
    self.titleLabel.frame = CGRectMake(70 * HORIZONTAL, 10 * VERTICAL, 100 * HORIZONTAL, 20 * VERTICAL);
    self.locationLabel.frame = CGRectMake(70 * HORIZONTAL, 40 * VERTICAL, 100 * HORIZONTAL, 20 * VERTICAL);
    self.starMarkView.frame = CGRectMake(WIDTH - 170 * HORIZONTAL, 10 * VERTICAL, 140 * HORIZONTAL, 20 * VERTICAL);
    self.oneStarImageView.frame = CGRectMake(0, 0, 20, 20);
    self.twoStarImageView.frame = CGRectMake(20, 0, 20, 20);
    self.threeStarImageView.frame = CGRectMake(40, 0, 20, 20);
    self.fourStarImageView.frame = CGRectMake(60, 0, 20, 20);
    self.fiveStarImageView.frame = CGRectMake(80, 0, 20, 20);
    self.markLabel.frame = CGRectMake(100, 0, 40, 20);
    self.commentLabel.frame = CGRectMake(WIDTH - 150 * HORIZONTAL, 40 * VERTICAL, 80 * HORIZONTAL, 20 * VERTICAL);
    self.leftImageView.frame = CGRectMake(10, 70 * VERTICAL, (WIDTH - 35) / 4, (WIDTH - 35) / 4);
    self.midLeftImageView.frame = CGRectMake((WIDTH - 35) / 4 + 15, 70 *VERTICAL, (WIDTH - 35) / 4, (WIDTH - 35) / 4);
    self.midRightImageView.frame = CGRectMake((WIDTH - 35) / 4 * 2 + 20, 70 *VERTICAL, (WIDTH - 35) / 4, (WIDTH - 35) / 4);
    self.rightImageView.frame = CGRectMake((WIDTH - 35) / 4 * 3 + 25, 70 * VERTICAL, (WIDTH - 35) / 4, (WIDTH - 35) / 4);
    self.worksLabel.frame = CGRectMake((WIDTH - 35) / 4 - 85 * HORIZONTAL, (WIDTH - 35) / 4 + 80 * VERTICAL, 140, 30);
    self.textField.frame = CGRectMake(WIDTH / 2, (WIDTH - 35) / 4 + 80 * VERTICAL, 1, 30);
    self.appointmentLabel.frame = CGRectMake((WIDTH - 35) / 4 * 2 + 30, (WIDTH - 35) / 4 + 80 * VERTICAL, 120, 30);
}


@end
